<template>
	<view>
		<view class="swiper" style="padding: 20rpx;background-color: #fff;">
			<u-swiper :list="swiperList" @click="to" height="400" mode="none"></u-swiper>
		</view>
		<u-gap height="20" bg-color="#f7f7f7"></u-gap>
		<view class="news" style="padding: 20rpx;">
			<view class="title2" style="padding-bottom: 0;">医院推荐</view>
			<view class="news-list" style="display: flex;flex-direction: column;padding: 20rpx;background-color: #fff;">
				<view class="news-item" style="padding: 20rpx 0;border-top: 2rpx solid #e4e7ed;display: flex;flex-direction: row;
				justify-content: space-between;" v-for="item in hospitalList">
					<view class="right center">
						<navigator :url="`/pages/hospital-detail/hospital-detail?id=${item.id}`">
							<image :src="$baseUrl + item.imgUrl" mode="" style="width: 250rpx;height: 200rpx;"></image>
						</navigator>
					</view>
					<view class="left" style="width: 450rpx;margin-left: 20rpx;">
						<view class="top">
							<text style="font-size: 36rpx;font-weight: bold;" class="line">{{item.hospitalName}}</text>
							<u-rate :count="count" v-model="item.level" style="padding: 15rpx 0;"></u-rate>
							<rich-text :nodes="item.brief" class="line" style="color: #909399;font-size: 26rpx;"></rich-text>
						</view>
						<view class="bottom"></view>
					</view>
				</view>
				<u-divider color="#909399">没有更多了</u-divider>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				swiperList: [],
				hospitalList: [],
				count: 5
			};
		},
		onLoad() {
			this.getSwiper()
			this.getHospital()
		},
		methods: {
			getSwiper(){
				this.$request({
					url: '/prod-api/api/hospital/banner/list'
				}).then(res => {
					console.log(res)
					this.swiperList = res.data.map(item => ({image: this.$baseUrl + item.imgUrl, id: item.id}))
				})
			},
			getHospital(){
				this.$request({
					url: '/prod-api/api/hospital/hospital/list'
				}).then(res => {
					this.hospitalList = res.rows
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
